hysop.operator.directional.stretching_dir module

@file stretching_dir.py Directional stretching frontend (operator generator).

class hysop.operator.directional.stretching_dir.DirectionalStretching(formulation, velocity, vorticity, variables, dt, C=None, A=None, name=None, implementation=None, base_kwds=None, **kwds)[source]

Bases: DirectionalSymbolic

Directional stretching using the symbolic code generation framework.

Initialize directional stretching operator frontend.

Vortex stretching is the lengthening of vortices in three-dimensional fluid flow, associated with a corresponding increase of the component of vorticity in the stretching direction due to the conservation of angular momentum.

Solves dW/dt = C * f(U,W) where U is the velocity, W the vorticity and f is one of the following formulation:

CONSERVATIVE FORMULATION: f(U,W) = div( U : W ) MIXED GRADIENT FORMULATION: f(U,W) = (A*grad(U) + (1-A)*grad(U)^T) . W

whererepresents the outer product U:W = (Ui*Wj)ij.

. represents the matrix-vector product.

^T is the transposition operator

U and W are always three dimensional fields. C is scalar or 3d vector-like of symbolic coefficients. A is a scalar symbolic coefficient. f(U,W) is always directionally splittable.

Parameters:
  • formulation (hysop.constants.StretchingFormulation) –

    The formulation of this stretching operator: CONSERVATIVE: f(U,W) = div( U : W ) GRAD_UW: f(U,W) = grad(U) . W GRAD_UW_T: f(U,W) = grad(U)^T . W MIXED_GRAD_UW: f(U,W) = (A*grad(U) + (1-A)*grad(U)^T) . W

    where A is a user given scalar or 3d vector like that contains scalar (floating point) coefficient(s) or parameter(s). The most common mixed gradient formulation is A=0.5.

    GRAD_UW, GRAD_UW_T and MIXED_GRAD_UW formulations are only valid for incompressible flows, see Notes.

  • velocity (Field) – Velocity U as read-only input three-dimensional continuous field.

  • vorticity (Field) – Vorticity W as read-write three-dimensional continuous field.

  • variables (dict) – Dictionary of fields as keys and topology descriptors as values.

  • dt (ScalarParameter) – Timestep parameter that will be used for time integration.

  • C (scalar or vector like of 3 symbolic coefficients, optional) – The stretching leading coefficient C can be scalar or vector like. Contained values should be numerical coefficients, parameters or generic symbolic expressions such that C*f(U,W) is directionally splittable. Here * is the classical elementwise multiplication. Default value is 1.

  • A (scalar symbolic coefficient, optional) – Should only be given for MIXED_GRAD_UW formulations. ValueError will be raised on other formulations. The linear combination coefficients A is a scalar. Contained value should be a numerical coefficient, a parameter (or a generic symbolic expression) such that C*(A*grad(U).W + (1-A)*grad^T(U).W) is directionally splittable. Here * is the classical elementwise multiplication. Default value is 0.5.

  • name (str, optional, defaults to 'stretching'.) – Name of this stretching operator.

  • implementation (Implementation, optional, defaults to None) – Target implementation, should be contained in available_implementations(). If None, implementation will be set to default_implementation().

  • base_kwds (dict, optional, defaults to None) – Base class keywords arguments. If None, an empty dict will be passed.

  • kwds – Keywords arguments that will be passed towards implementation operator __init__.

Notes

The MIXED GRADIENT formulation is only valid for incompressible flows (ie. only if div(U)=0). It is obtained by expanding the conservative formulation and simplifying with div(U)=0. The linear combination of gradients comes from this first equation and the fact that (grad(U)-grad(U)^T).W = 0.

class hysop.operator.directional.stretching_dir.StaticDirectionalStretching(formulation, velocity, vorticity, variables, dt, C=None, A=None, name=None, implementation=None, base_kwds=None, **kwds)[source]

Bases: DirectionalOperatorFrontend

Directional stretching using the symbolic code generation framework.

Initialize directional stretching operator frontend.

Vortex stretching is the lengthening of vortices in three-dimensional fluid flow, associated with a corresponding increase of the component of vorticity in the stretching direction due to the conservation of angular momentum.

Solves dW/dt = C * f(U,W) where U is the velocity, W the vorticity and f is one of the following formulation:

CONSERVATIVE FORMULATION: f(U,W) = div( U : W ) MIXED GRADIENT FORMULATION: f(U,W) = (A*grad(U) + (1-A)*grad(U)^T) . W

whererepresents the outer product U:W = (Ui*Wj)ij.

. represents the matrix-vector product.

^T is the transposition operator

U and W are always three dimensional fields. C is scalar or 3d vector-like of symbolic coefficients. A is a scalar symbolic coefficient. f(U,W) is always directionally splittable.

Parameters:
  • formulation (hysop.constants.StretchingFormulation) –

    The formulation of this stretching operator: CONSERVATIVE: f(U,W) = div( U : W ) GRAD_UW: f(U,W) = grad(U) . W GRAD_UW_T: f(U,W) = grad(U)^T . W MIXED_GRAD_UW: f(U,W) = (A*grad(U) + (1-A)*grad(U)^T) . W

    where A is a user given scalar or 3d vector like that contains scalar (floating point) coefficient(s) or parameter(s). The most common mixed gradient formulation is A=0.5.

    GRAD_UW, GRAD_UW_T and MIXED_GRAD_UW formulations are only valid for incompressible flows, see Notes.

  • velocity (Field) – Velocity U as read-only input three-dimensional continuous field.

  • vorticity (Field) – Vorticity W as read-write three-dimensional continuous field.

  • variables (dict) – Dictionary of fields as keys and topology descriptors as values.

  • dt (ScalarParameter) – Timestep parameter that will be used for time integration.

  • C (scalar or vector like of 3 symbolic coefficients, optional) – The stretching leading coefficient C can be scalar or vector like. Contained values should be numerical coefficients, parameters or generic symbolic expressions such that C*f(U,W) is directionally splittable. Here * is the classical elementwise multiplication. Default value is 1.

  • A (scalar symbolic coefficient, optional) – Should only be given for MIXED_GRAD_UW formulations. ValueError will be raised on other formulations. The linear combination coefficients A is a scalar. Contained value should be a numerical coefficient, a parameter (or a generic symbolic expression) such that C*(A*grad(U).W + (1-A)*grad^T(U).W) is directionally splittable. Here * is the classical elementwise multiplication. Default value is 0.5.

  • name (str, optional, defaults to 'stretching'.) – Name of this stretching operator.

  • implementation (Implementation, optional, defaults to None) – Target implementation, should be contained in available_implementations(). If None, implementation will be set to default_implementation().

  • base_kwds (dict, optional, defaults to None) – Base class keywords arguments. If None, an empty dict will be passed.

  • kwds – Keywords arguments that will be passed towards implementation operator __init__.

Notes

The MIXED GRADIENT formulation is only valid for incompressible flows (ie. only if div(U)=0). It is obtained by expanding the conservative formulation and simplifying with div(U)=0. The linear combination of gradients comes from this first equation and the fact that (grad(U)-grad(U)^T).W = 0.

classmethod default_implementation()[source]

Return the default Implementation, should be compatible with available_implementations.

classmethod implementations()[source]

Should return all implementations as a dictionnary. Keys are Implementation instances and values are either ComputationalGraphNode or ComputationalGraphNodeGenerator.